const path = require('path')
const webpack = require('webpack')
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.common')

const { configureWebpack, configureWebpack: { prod }} = global.DAIT_CONFIG

const prodWebpackConfig = merge(commonConfig, {
  mode: 'production',
  output: {
    filename: 'js/[name]-[contenthash:8].js'
  },
  devtool: prod.devtool,
  optimization: prod.optimization,
  module: {
    rules: configureWebpack.rules.concat(prod.rules)
  },
  plugins: configureWebpack.plugins.concat(prod.plugins)
})

module.exports = prodWebpackConfig